<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--友情链接编辑页面-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>无标题文档</title>
    <link href="css/style2.css" rel="stylesheet" type="text/css"/>

    <!--JS上传文件-->
    <script type="text/javascript">

        function previewFile() {
            // var preview = document.querySelector('img');
            var preview = document.getElementById('view_image');
            var file = document.querySelector('input[type=file]').files[0];
            var reader = new FileReader();

            reader.onloadend = function () {
                preview.src = reader.result;
            }

            if (file) {
                reader.readAsDataURL(file);
            } else {
                preview.src = "";
            }
        }

    </script>


</head>

<body>

<div class="formbody">
    <div class="formtitle"><span>友情链接</span></div>
<form action="AHerfs_editSurveillanceSystem?id=${AHerf.id }" method="post"
			enctype="multipart/form-data">
    <ul class="forminfo">
        <li><label>标题：</label><input name="title" type="text" class="dfinput" value="${AHerf.title }" /><i>标题不能超过10个字符</i></li>
        <li><label>链接地址：</label><input name="aherf" type="text" class="dfinput" value="${AHerf.aherf }"/><i>该图片的链接地址</i></li>

        <li><label>选择图片：</label>

            <img id="view_image" src="images/${AHerf.picture }" height="200" alt="Image preview...">
            <br>
            <label>&nbsp;</label><input class="selectfile" type="file"  name="file" onchange="previewFile()"><br>
        </li>
        <ul style=" float:left;display: inline">
            <li style="display: inline">
                <a href="HomeFriendshipLinks.html" target="rightFrame"/>
                <input name="" type="submit" class="btn" value="确认"/>
            </li>
        </ul>


    </ul>
</form>

</div>
</body>
</html>
